PackageDescription: Method Wrappers(Bundle)


Method Wrappers

Last published: November 6, 2006 by 'bobw'


VW 7 version of the method wrappers package (see http://www.refactory.com/Software/MethodWrappers/ for more information).

Method Wrappers add hidden behavior to a method without recompiling it. They can be used to change a method's behavior. Commonly, they are used to add behavior before and after the default method executes. For example, we can create a coverage tool by using a method wrapper that increments a counter when it is called; the coverage tool in this bundle is an example, as is the type-recovering Analysis Browser (see bundle Zork-Analysis in the open repository). Another use is to alter behaviour during test runs, e.g. by wrapping dialog-raising methods by ones that instead return the answer the test requires; for an example, see EndToEndBrowserTests in the Custom Refactoring project downloads (http://customrefactor.sourceforge.net).

If you would like more detailed information about method wrappers, you can read the ECOOP'98 paper Wrappers to the Rescue.

WARNING: Incorrectly using the wrappers can crash your image, so you should save your image before using them. Most problems occur as a result of installing them on methods that are called either in the beforeMethod or afterMethod which results in infinite recursion.